<!DOCTYPE html>
<html lang='en'>

<head>
  <meta charset='UTF-8'>
  <meta name='viewport' content='width=device-width, initial-scale=1.0'>
  <title></title>
  <script type='text/javascript' src='js/vue.js'></script>
</head>

<body>
  <div id='app'>
    <div>
      <div>
        <label for="username">用户名</label>
        <input type="text" name="username" v-model.trim.lazy="username">
      </div>
      <div>
        <label for="password">密码</label>
        <input type="text" name="password" v-model.trim="password">
      </div>
      <input type="submit" value="提交" @click.prevent="handle">
    </div>
  </div>
  <script type='text/javascript'>
    var vm = new Vue({
      el: '#app',
      data: {
        username: '',
        password: ''
      },
      methods: {
        handle() {
          console.log(this.username, this.password);
        }
      }
    });
  </script>
</body>

</html>